const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: 'string',
        brandCode: 'string',
        dealerCode: 'string',
        dutyUnitCode: 'string',
        productCategoryCode: 'string',
        partCode: 'string',
        partName: 'string',
        qty: 10,
        laborFee: 10,
        totalAmount: 10,
        status: 1,
        rowVersion: 'string',
        options: [
            'update',
            'abandon',
        ]
    });
    res.json({
        message: '',
        payload: { 
            content,
            totalElements: 40,
        }
    });
});
router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: '1',
                code: 'string',
                brandCode: 'string',
                dealerCode: 'string',
                dutyUnitCode: 'string',
                productCategoryCode: 'string',
                partCode: 'string',
                partName: 'string',
                qty: 10,
                laborFee: 10,
                totalAmount: 10,
                status: 1,
                rowVersion: 'string',
                brandId: 'string',
                dealerId: 'string',
                dealerName: 'string',
                dutyUnitId: 'string',
                dutyUnitName: 'string',
                productCategoryId: 'string',
                partId: 'string',
                detailQTY: 10,
                remark: 'string',
                options: [
                    'update',
                    'abandon',
                ],
                details: [
                    {
                        id: 'string',
                        claimCode: 'string',
                        status: 1,
                        qty: 10
                    }
                ]
            }
        }
    );
});

router.put('/:id', (req, res) => {
    res.json({
        message: '编辑成功'
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});
router.get('/:id/export', (req, res) => {
    res.json({
        message: '导出成功'
    });
});
module.exports = router;
